package com.serviceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.bean.Material;
import com.mapper.MaterialMapper;
import com.service.MaterialService;

/**
 * @author author : 张鹏
 * @date createTime：2018年1月11日 下午9:48:28
 * @Description: 该类的功能描述
 */
@Service
public class MaterialServiceImpl implements MaterialService {
	@Resource
	private MaterialMapper materialMapper;

	@Override
	public List<Material> getAllMaterial() {
		// TODO Auto-generated method stub
		return materialMapper.selectAll();
	}

	@Override
	public int createNewMaterial(Material material) {
		// TODO Auto-generated method stub
		return materialMapper.insert(material);
	}

	@Override
	public int deleteMaterial(int materialId) {
		// TODO Auto-generated method stub
		return materialMapper.deleteByPrimaryKey(materialId);
	}

	@Override
	public int editMaterial(Material material) {
		// TODO Auto-generated method stub
		return materialMapper.updateByPrimaryKey(material);
	}

	@Override
	public Material getMaterialByPrimaryKey(int id) {
		// TODO Auto-generated method stub
		return materialMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<Material> getMaterialByMaterialIdOrMaterialName(
			String searchWords) {
		// TODO Auto-generated method stub
		return materialMapper.selectByMaterialIdOrMaterialName(searchWords);
	}

}
